package com.lu.api.schedule;

import com.lu.model.common.dtos.ResponseResult;
import com.lu.model.schedule.dto.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


//任务feign接口
@FeignClient("news-schedule")
public interface IScheduleClient {


    /**
     * 添加任务
     * @param task 任务对象
     * @return 任务ID
     */
    @PostMapping("/api/v1/task/add")
    ResponseResult addTask(@RequestBody Task task);


    /**
     * 取消任务
     * @param taskId
     * @return
     */
    @GetMapping("/api/v1/task/cancel/{taskId}")
    ResponseResult cancelTask(@PathVariable("taskId") long taskId);


    /**
     * 消费任务
     * @param type
     * @param priority
     * @return
     */
    @GetMapping("/api/v1/task/poll/{type}/{priority}")
    ResponseResult pullTask(@PathVariable("type") Integer type, @PathVariable("priority") Integer priority);
}
